package cn.zeal4j.servlet.freemarker;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Date;

/**
 * @author Administrator
 * @file IntelliJ IDEA FreeMarker
 * @create 2020 09 21 11:21
 */
@WebServlet("fm-02")
public class FtlServlet02 extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setAttribute("flag", true);
        req.setAttribute("today", new Date());
        req.setAttribute("IntegerNumber", 100);
        req.setAttribute("FloatNumber", 100.233F);
        req.setAttribute("emptyValue", "");

        req.getRequestDispatcher("freemarker-templates/fmt-02.ftl").forward(req, resp);
    }
}
